Skip to content

ADFA-5337 chore(build): build without google-services.json (conditional Firebase + analytics off) - #495

Merged
luisguzman-adfa merged 2 commits into
mainfrom
chore/ADFA-5337-build-without-google-services
Aug 28, 2026
Merged

ADFA-5337 chore(build): build without google-services.json (conditional Firebase + analytics off)#495
luisguzman-adfa merged 2 commits into
mainfrom
chore/ADFA-5337-build-without-google-services

Conversation

@luisguzman-adfa

Copy link
Copy Markdown
Collaborator

Build from a fresh clone without google-services.json.

The com.google.gms.google-services plugin fails the build when google-services.json
is absent, and that file (real Firebase keys) is gitignored — so a fresh clone can't
build until someone supplies it. This makes the file optional for local/contributor
builds while release builds keep Firebase.

  • build.gradle: apply the google-services plugin conditionally
    (file("google-services.json").exists()), out of the plugins {} block; expose
    BuildConfig.ANALYTICS_ENABLED from the same check.
  • AnalyticsClient: gate()/applyConsent() no-op when ANALYTICS_ENABLED is false, so no
    code path touches the uninitialized Firebase SDK. Firebase is referenced only here,
    so the two guards cover it fully.

Behavior:

  • No google-services.json -> plugin skipped, analytics compiled out, APK builds and
    runs (a harmless FirebaseInitProvider warning in logcat is expected).
  • google-services.json present -> plugin applied, analytics on, exactly as before.

Relates to ADFA-5302 (build-resilience for contributor environments).

…al Firebase + analytics off)

A fresh clone can't build: the com.google.gms.google-services plugin fails when
google-services.json is missing, and that file holds the real Firebase keys so it
is gitignored (not in the repo).

Apply the plugin only when the file is present, and flag AnalyticsClient off when
it isn't, so a contributor gets a working APK with analytics compiled out while
release builds drop in the real file to enable Firebase.

- controller/app/build.gradle: move google-services out of the plugins {} block and
  apply it conditionally at the bottom (file("google-services.json").exists());
  expose BuildConfig.ANALYTICS_ENABLED from the same check.
- AnalyticsClient: gate() and applyConsent() short-circuit when ANALYTICS_ENABLED is
  false, so no path touches the uninitialized Firebase SDK (Firebase is referenced
  only in this class). A harmless FirebaseInitProvider warning in logcat is expected
  when building without the file; the app does not crash.

No behavior change for release builds (file present -> plugin applied, analytics on).
…ompiled out

Follow-up to the conditional Firebase build: when built without google-services.json
(BuildConfig.ANALYTICS_ENABLED = false) there is nothing to share, so the opt-in UI
should not appear.

- SettingsSubFragment: the "Share usage statistics" toggle is not added.
- AboutFragment (+ fragment_about.xml): the "Share anonymous data" row + description
  are GONE (ids added to hide them).
- WizardActivity / SetupSectionFragment: the first-run analytics enrollment prompt is
  skipped and the flow proceeds.

No change when analytics is enabled (file present): the UI shows exactly as before.
@luisguzman-adfa
luisguzman-adfa merged commit dd0a05f into main Aug 28, 2026
3 checks passed
@luisguzman-adfa
luisguzman-adfa deleted the chore/ADFA-5337-build-without-google-services branch August 28, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant